// initial state
const state = {
  user: {
    sexEnum: [{ key: 1, value: '男' }, { key: 2, value: '女' }],
    statusEnum: [{ key: 1, value: '启用' }, { key: 2, value: '禁用' }],
    levelEnum: [{ key: 1, value: '淮安市消防救援支队' }, { key: 2, value: '徐杨特勤站' },
      { key: 3, value: '清江浦区消防大队' },
      { key: 4, value: '开发区消防大队' },
      { key: 5, value: '淮阴区消防大队' },
      { key: 6, value: '淮安区消防大队' },
      { key: 7, value: '洪泽区消防大队' },
      { key: 8, value: '涟水县消防大队' },
      { key: 9, value: '金湖县消防大队' },
      { key: 10, value: '盱眙县消防大队' },
      { key: 11, value: '工业园区消防大队' },
      { key: 12, value: '生态文旅区消防大队' },
      { key: 13, value: '苏淮高新技术产业开发区消防大队' },
      { key: 14, value: '水上大队' },
      { key: 15, value: '水门桥站' },
      { key: 16, value: '城西站' },
      { key: 17, value: '清安站' },
      { key: 18, value: '水上城南站' },
      { key: 19, value: '威海路站' },
      { key: 20, value: '王营站' },
      { key: 21, value: '翔宇站' },
      { key: 22, value: '黎城站' },
      { key: 23, value: '高良涧站' },
      { key: 24, value: '都梁站' },
      { key: 25, value: '宁连路站' },
      { key: 26, value: '板闸站' },
      { key: 27, value: '安东站' },
      { key: 28, value: '盐化新材料产业园区专职消防站' },
      { key: 29, value: '万达专职消防站' },
      { key: 30, value: '季桥专职消防站' },
      { key: 31, value: '施河专职消防站' },
      { key: 32, value: '渔沟专职消防站' },
      { key: 33, value: '徐溜专职消防站' },
      { key: 34, value: '岔河专职消防站' },
      { key: 35, value: '薛行化工园区专职消防站' },
      { key: 36, value: '高沟专职消防站' },
      { key: 37, value: '红窑专职消防站' },
      { key: 38, value: '马坝专职消防站' },
      { key: 39, value: '银涂专职消防站' },
      { key: 40, value: '淮城专职消防站' },
      { key: 41, value: '高铁商务区专职消防站' },
      { key: 42, value: '南马厂专职消防站' }
    ],
    roleEnum: [{ key: 1, value: '消防员' }, { key: 2, value: '指导员' }, { key: 3, value: '管理员' }],
    statusTag: [{ key: 1, value: 'success' }, { key: 2, value: 'danger' }],
    statusBtn: [{ key: 1, value: '禁用' }, { key: 2, value: '启用' }]
  },
  exam: {
    examPaper: {
      paperTypeEnum: [{ key: 6, value: '任务试卷' }]
    },
    question: {
      typeEnum: [{ key: 1, value: '单选题' }, { key: 2, value: '多选题' }, { key: 3, value: '判断题' }, { key: 4, value: '填空题' }, { key: 5, value: '简答题' }],
      editUrlEnum: [{ key: 1, value: '/exam/question/edit/singleChoice', name: '单选题' },
        { key: 2, value: '/exam/question/edit/multipleChoice', name: '多选题' },
        { key: 3, value: '/exam/question/edit/trueFalse', name: '判断题' },
        { key: 4, value: '/exam/question/edit/gapFilling', name: '填空题' },
        { key: 5, value: '/exam/question/edit/shortAnswer', name: '简答题' }]
    }
  }
}

// getters
const getters = {
  enumFormat: (state) => (arrary, key) => {
    return format(arrary, key)
  }
}

// actions
const actions = {}

// mutations
const mutations = {}

const format = function (array, key) {
  for (let item of array) {
    if (item.key === key) {
      return item.value
    }
  }
  return null
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}
